//
//  MYXMemberMdel.m
//  meiyinxiang
//
//  Created by 陈李飞 on 2017/10/30.
//  Copyright © 2017年 hbjApple. All rights reserved.
//

#import "MYXMemberMdel.h"
#import "JKCoding.h"


#define USER_info_DATA_FILE [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject] stringByAppendingPathComponent:@"meiyinxiang_account_info.plist"]
@implementation MYXMemberMdel
- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

- (void)setNilValueForKey:(NSString *)key{
    
}

+ (instancetype)sharedInstance {
    static MYXMemberMdel *sharedInstance = nil;
    
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        MYXMemberMdel *currentUser = [self getCurrentUser];
        
        if (currentUser) {
            sharedInstance = currentUser;
        } else {
            sharedInstance = [[self alloc] init];
        }
    });
    
    return sharedInstance;
}

- (BOOL)save {
  BOOL isSucess =  [NSKeyedArchiver archiveRootObject:self toFile:USER_info_DATA_FILE];
    return isSucess;
}
- (void)updata{
    
}

+ (instancetype)getCurrentUser {
    MYXMemberMdel *user = [NSKeyedUnarchiver unarchiveObjectWithFile:USER_info_DATA_FILE];
    
    return user;
}
MJCodingImplementation
@end
